package internationalenergytradingplatform.dao;

import com.github.pagehelper.Page;
import internationalenergytradingplatform.VO.BuyerCommodityVO;
import internationalenergytradingplatform.dto.CommodityPageQueryDTO;
import internationalenergytradingplatform.pojo.Classification;
import internationalenergytradingplatform.pojo.Commodity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CommodityMapper {
    /**
     *供应商分页查询商品
     */
    Page<Commodity> CommodityPageQuery(CommodityPageQueryDTO commodityPageQueryDTO);

    /**
     * buyer分页查询商品
     */
    Page<Commodity> CommodityPageQueryByBuyer(CommodityPageQueryDTO commodityPageQueryDTO);

    /**
     * 查找某一类别的所有商品
     */
    @Select("select * from commodity_tb where classification = #{classification}")
    List<Commodity> getAllCommodityByClassification(Integer classification);

    /**
     * 返回采购商状态数据
     * @return
     */
    BuyerCommodityVO getById(Integer id);

    /**
     *
     * @author yingfeng
     * @date 2024/3/29 13:57
     查询某供应商的所有类别
     */
    @Select("SELECT * FROM INTERNATIONAL_ENERGY_CONNECT_DB.commodity_classification where accountr = #{tele};")
    List<Classification> getAllCommodityByShopId(String tele);

}
